<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.is.control.*" %>
<%@ page import="com.is.model.*" %>
<%@page import="java.util.List"%>
<%@page import="com.is.util.DateTime"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/InterStu/resources/image/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../resources/css/all.css" />
<link rel="stylesheet" type="text/css" href="../../resources/css/add.css" />
<link href="../../resources/css/uploadify.css" rel="stylesheet" type="text/css" />
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/popUpWin.js"></script>
<script type="text/javascript" src="../../resources/js/WebCalendar.js"></script>
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/swfobject.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<script type="text/javascript" src="../../resources/js/iframeTools.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.uploadify.v2.0.3.min.js"></script>
<script type="text/javascript">
	(function (config) {
	    config['fixed'] = true;
	    config['okVal'] = '确定';
	    config['cancelVal'] = '取消';
		config['skin'] = 'default';
		config['drag'] = 'true';
	    // [more..]
	})(art.dialog.defaults);	
	$(function(){
		var block = $("#magic_block");
		if($(".active a").position()){
			block.css("top",$(".active a").position().top+10)
			.data("oriTop",$(".active a").position().top)
		}
		$(".nav ul li").find("a").hover(
			function(){
				var $this = $(this);
				var newTop = $this.position().top;
				block.stop().animate({
					top:newTop+10
				})
			},
			function(){
				block.stop().animate({
					top:block.data("oriTop")+10
				})
			}
		)
		$("#uploadify").uploadify({
                'uploader'       : '../../resources/image/uploadify.swf',
                'script'         : '/InterStu/servlet/fileUpload',
                'cancelImg'      : '../../resources/image/cancel.png',
                'queueID'        : 'fileQueue',
                'auto'           : false,
                'multi'          : false,
                'buttonText'     : 'Browse file',
                            
	            onComplete: function (evt, queueID, fileObj, response, data) {
					$('<li></li>').appendTo('.files').text(response);
					var reg = /%20/g;
					var node = response + "";
        			var path = node.substring(node.indexOf("：")+1).replace(/\s*COMPOLETE\s*/gi,"");
        			var name = node.substring(0,node.indexOf("："));
        			document.getElementsByName(name)[0].value= "/InterStu/uploads/resourses/" + name + "/" + encodeURIComponent(path);
				},
				onError: function(a, b, c, d) {
		             alert("文件上传失败");
       			}
            });
			$("#info").submit(function(){
				var start = $("#duration1").val();
				var end = $("#duration2").val();
				if(start == ""){
					start="2012-09-01"
				}
				if(end == ""){
					end="2013-02-04"
				}
				$("#duration").val(start + "至" + end);
			});
			$(".mainContainer").hide();
			$("#addbtn").click(function(){
				$.dialog({ 
				title: "上传附件",
				width: "508px",
			 	content: document.getElementById("idd"),  
			 	cancelVal: '关闭',
    			cancel: true  
			})
			})
			$("#update").hide();
			$(".photo").hover(
				function(){
					$("#update").show();
				},
				function(){
					$("#update").hide();
				}
			)
			var h = $(".right").height();
		$(".left").height(h);
		$(".update").click(function(){
			$.dialog.open("/InterStu/update_info.jsp",{width:460,height:400,title:"个人信息"});
		})
		$('img').error(function(){
			this.src = "/InterStu/resources/image/man.GIF";
		})
	});
	function uploadifyUpload(){
		var category = $('#category').val();
		if(category=="0"){
			alert("请选择申请类别");
		}else{
			$('#uploadify').uploadifySettings('scriptData', {'category' : category});
  				$('#uploadify').uploadifyUpload();
		}   					
	}	
</script>
<title>留学生预科班</title>
</head>
<% 
	User cu =(User)session.getAttribute("user"); 
	request.setCharacterEncoding("UTF-8");
	if(cu!=null&&cu.getRole().equals("0")){
		response.sendRedirect("student_admin.jsp?id=" + cu.getId());
	}
	String defaultPicUrl="../../resources/image/man.GIF";
	String path = "../../User/UserHeadImage/";
	//String picUrl = path + (String)session.getAttribute("picUrl");
	//System.out.println("pp" + picUrl);
	//if(session.getAttribute("picUrl")==null){
		//picUrl = defaultPicUrl;
	//}
	session.removeAttribute("picUrl");
%>
<body>
<div class="header">
	<div class="title pr">
    	<a href="javascript:void(0);"><span class="update pa">个人信息</span></a>
        <span class="logout pa"><a class="hide" href="/InterStu/login/logout.jsp">退出</a></span>
    </div>
</div>
<div class="main">
	<div class="left" >  
	  <div class="infomation">
			<div class="photo">
			<%
			String picUrl = cu.getPicUrl();
			if(session.getAttribute("picUrl")!=null){
			    picUrl = "/InterStu/User/UserHeadImage/"+(String)session.getAttribute("picUrl");
			}	
			System.out.print(picUrl);
			%>
				<img width='60' height="60" src = "<%=picUrl %>"  />
			</div>
			<div class="welcome">
				<%=cu.getName() %>,<br/>
				欢迎您使用！
			</div>
		</div>  	   	
    	<div class="nav">
        	<ul>	
        		<li class="pa" id="magic_block"></li>
            <%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li><a href="/InterStu/pages/stuyear/stuyear_start.jsp">新学期设置</a></li>
                <li><a href="/InterStu/pages/users/user_all.jsp">用户管理</a></li>
                <%} %>
                <li class="active"><a href="/InterStu/pages/students/student_add.jsp">学生管理</a></li>
                <li ><a href="/InterStu/pages/dictation/dictation_add.jsp">学生考核</a></li>
                <%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li><a href="/InterStu/pages/assess/teacher_assess.jsp">教职人员管理</a></li>
                <%} %>
            </ul>
        </div>
    </div>
    <div class="right" >
    <div class="r1">
    	<table class="student tab">
    <tr>
    <%if(cu!=null&&cu.getRole().equals("1")){ %>
    	<td>
    		<a class='current' href="/InterStu/pages/students/student_add.jsp">添加学生</a>
		</td>
		<%} %>
		<td>
			<a href="/InterStu/pages/students/student_admin.jsp?id=<%=cu.getId() %>">查看学生</a>
		</td>
		<td>
			<a href="/InterStu/pages/attendance/attendance_add.jsp">学生出勤</a>
		</td>
    </tr>
    </table>
    	<form action='student_add_do.jsp' id="info" method='post'>
		<table border='1'  class='table' >
		<caption class="stu_inf">学生信息&nbsp;&nbsp;&nbsp;Information</caption>
		<tbody>
			<tr>
				<td>护照用名<br/>Passport Name</td>
				<td colspan='2'><input type='text' style="width:90%" name='passportName'/> </td>
				<td>中文姓名<br/>Chinese Name</td>
				<td><input type='text' name='chineseName'/></td>
			</tr>
			<tr>
				<td>国籍</td>
				<td><input type='text' name='nationality'/></td>
				<td rowspan='2'>性别<br/>Sex</td>
				<td rowspan='2'><input type='radio' name='sex' value="1" checked/>男&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='sex'  value="0"/>女</td>
				<td colspan='1' rowspan='6'>
				<input type="hidden" id="updateImgs" name="picPath" value=""/>
				<div class="photo pr">
					<img id="imgs" width='150' height='150' src='../../resources/image/man.GIF'/> 
					<a id="update" href="javascript:PopUpWindow('../../uploadimage.jsp',100,100,600,500);">修改照片</a>
				</div>
				</td>
			</tr>
			<tr>
				<td>Nationality</td>
				<td><input type='text' name='nationalityEn'/></td>
			</tr>
			<tr>
				<td>出生日期<br/>Date of Birth</td>
				<td><input  id="birthday"  onclick="SelectDate(this,'','','yyyy-MM-dd')" readonly style="cursor:pointer"  type='text' name="birthday"/></td>
				<td>班级<br/>Class</td>
				<td>(<%=ParamStuyearControl.getCurrentStuyear().getStuyear()%>)<select name="classId">
				<%
				   List<ParamClass> pcs = ParamClassControl.getParamClassesByStuyear(ParamStuyearControl.getCurrentStuyearId());
				for(ParamClass pc:pcs){
					%>
		           <option value="<%=pc.getId() %>"><%=pc.getClassName() %></option>
					<%
				}
				%>
				</select></td>
			</tr>
			<tr>
				<td>护照号码<br/>Passport Number</td>
				<td><input type='text' name="passportNumber"/></td>
				<td>CSC 号</td>
				<td><input type='text' name="CSCNumber"/></td>
			</tr>
			<tr>
				<td>经费办法<br/>Type of Scholarship</td>
				<td><input type='text' name='scholarshipType'/></td>
				<td>类别<br/>Level</td>
				<td><input type='text' name='level'/></td>
			</tr>
			<tr>
				<td>专业院校<br/>University</td>
				<td><input type='text' name="university"/></td>
				<td>专业<br/>Major</td>
				<td colspan='1'><input type='text' name='major'/></td>
			</tr>
			<tr>
				<td>学习时间<br/>Duration of Study</td>
				<td colspan="3"><input id="duration1" type='text' onclick="SelectDate(this,'','','yyyy-MM-dd')"  readonly style="cursor:pointer" />
				&nbsp;&nbsp;&nbsp; 至 &nbsp;&nbsp;&nbsp;
				<input id="duration2" onclick="SelectDate(this,'','','yyyy-MM-dd')" type='text' readonly style="cursor:pointer" />
				<input type="hidden" id="duration" name="duration"/></td>
				<td>
					<input id="addbtn" type="button" value="添加附件"/>
					<input type='hidden' name='Application'/>
					<input type='hidden' name='Admission'/>
					<input type='hidden' name='Passport'/>
					<input type='hidden' name='ChineseVisa'/>
				</td>
			</tr>
			<tr>
				<td>
					其他
				</td>
				<td >
					<input type="text" name="type" />
				</td>
				<td>
					备注
				</td>
				<td colspan="2">
					<input style="width:90%" type="text" name="tip" />
				</td>
			</tr>
			<tr>
			<td colspan='5'>
				<input type='reset' value='重置'/>&nbsp;&nbsp;&nbsp;&nbsp;
				<input type='submit' value='提交'/>
			</td>
			</tr>
		</tbody>
		</table>
		</form>
		<div class="mainContainer" id="idd">
			<div class="mainInfo">
				<p>
					<strong>操作流程说明：</strong><br/>
					1.选择类别<br/>
					2.点击"Browse file"按钮添加附件<br/>
					3.一次选择一个附件，加载成功后点击开始上传<br/>
					4.全部上传后，关闭窗口<br/>
				</p>
				<strong>注意：出于系统安全考虑，上传图片大小请不要超过1MB。</strong>
					<br/>
				类别：
				<select name="category" id="category">
					<option value="0">
						------请选择类别------
					</option>
		
					<option value="Application">外国留学人员来华签证申请表</option>
					<option value="Admission">录取通知书</option>
					<option value="Passport">护照</option>
					<option value="ChineseVisa">中华人民共和国签证</option>
		
				</select>
				<br/><br/>
				<input type="file" name="uploadify" id="uploadify" />		
				
				<div id="fileQueue"></div>
				<br/>
				<p>
					<a href="javascript:void(0);" class="btn" onClick="javascript:uploadifyUpload()">开始上传</a>&nbsp;
				</p>
				<p>
					
				</p>
				<ol class="files"></ol>
				</div>
		</div>
    </div>
    <div class="r2">
    <br/>
    </div>
</div>
</div>
<div class="footer">
	<p>版权所有：东北师范大学留学生预科部&nbsp;&nbsp;  蓝旭工作室开发</p>
</div>
</body>
</html>